package com.monkey.algorithm.chapter1

import com.monkey.helper.ResourcesHelper
import com.monkey.helper.WatchHelper
import org.junit.Test
import java.io.File

/**
 * 作者：Monkey
 * 日期：2018/1/28
 */
class ThreeSumTest {

    @Test
    fun count1K() {
        count("algs4-data${File.separator}1Kints.txt")
    }

    @Test
    fun count2K() {
        count("algs4-data${File.separator}2Kints.txt")
    }

    @Test
    fun count4K() {
        count("algs4-data${File.separator}4Kints.txt")
    }

    private fun count(path: String) {
        val intList: List<Int> = ResourcesHelper.readAllInt(path)
        val count = WatchHelper.logTime {
            ThreeSum.count(intList)
        }
        println(count)
    }
}